
mod unix_random;


use matrix_file_reader::Konfidenzmatrix;
use self::unix_random::*;

pub fn simuliere(matrix: Konfidenzmatrix<f32>, tat_wahl: bool) -> Result<bool, &'static str> {
    println!("{:?}", matrix);

    let bed_prob = matrix.bedingte_wahrscheinlichkeiten(tat_wahl);
    let rand_items = vec![ RandomItem { item: bed_prob[0].0, prob: bed_prob[0].1 },
                           RandomItem { item: bed_prob[1].0, prob: bed_prob[1].1 } ];
    let chooser = match BiasedChooser::new(rand_items) {
        Ok(bc) => { bc },
        Err(_k) => { return Err("Simulationsfehler!"); }
    };

    let res = chooser.choose();
    match res {
        Ok(r) => { Ok(r) },
        Err(_k) => { Err("Simulationsfehler.") }
    } 
}
